package com.appapi.pay.ali;

import java.io.IOException;
import java.io.InputStream;

public class AliUtils {
    private final static AliUtils aliUtils = new AliUtils();
    public static AliUtils getInst(){
        return aliUtils;
    }
    public  String getAlipayCertPublicKey() throws IOException {
        InputStream in1 = getClass().getClassLoader().getResourceAsStream("appCertPublicKey.crt");
        byte b[] = new byte[1024];
        String re = "";
        while (in1.read(b)!=-1){
            String s = new String(b);
            re+=s;
        }
        in1.close();
        return re;
    }
    public  String getAlipayRootCert() throws IOException {
        InputStream in1 = getClass().getClassLoader().getResourceAsStream("alipayRootCert.crt");
        byte b[] = new byte[16];
        String re = "";
        while (in1.read(b)!=-1){
            String s = new String(b);
            re+=s;
        }
        in1.close();
        return re;
    }
    public  String getAppCertPublicKey() throws IOException {
        InputStream in1 = getClass().getClassLoader().getResourceAsStream("appCertPublicKey.crt");
        byte b[] = new byte[1024];
        String re = "";
        while (in1.read(b)!=-1){
            String s = new String(b);
            re+=s;
        }
        in1.close();
        return re;
    }
}
